#ifndef _SPI_H_
#define _SPI_H_

#include "general.h"
#include <lpc2xxx.h>

#define SPI_COMMAND_WRITE   0
#define SPI_COMMAND_READ    1

typedef struct {
    tU32 cmd;           // SPI_COMMAND_READ or SPI_COMMAND_WRITE
    tU32 len;           // length of data
    tU8  *buf;          // pointer to data buffer
    tU32 cs;            // slave device CS pin (active low)
    volatile tU8 ready; // pointer to variable that is set to true when SPI is ready for a command
} spi_command_t;

extern spi_command_t spiCmd;

// SPI interrupt service routine
void spiISR(void);


#endif
